using System;
using System.Collections.Generic;

namespace OpenRay
{
	public class ArrayScene : IScene
	{
		private readonly List<Primitive> primitives = new List<Primitive>();
		
		public void AddPrimitive( Primitive p )
		{
			primitives.Add( p );	
		}
		
		public IList<PrimitiveHit> Trace( Ray r, uint depth )
		{
			List<PrimitiveHit> ret = new List<PrimitiveHit>();
			
			if ( depth == 0 )
				return ret;
			
			for ( int i = 0; i < primitives.Count; i++ )
			{
				primitives[i].Trace(r, depth, ret);
			}
			
			ret.Sort();
			
			return ret;
		}
	}
}

